
proc fixgridup (pwn : int)
    var workrecord : ship
    var numhits : int
    putout(intstr(pwn))
    for i : 1 .. pwn
	workrecord := userships (i)
	if workrecord.mode = 1 then
	    for a : workrecord.startx .. workrecord.endx
		placeturt (GridWin, a, workrecord.starty, 0)
	    end for
	elsif workrecord.mode = 2 then
	    for decreasing a : workrecord.startx .. workrecord.endx
		placeturt (GridWin, a, workrecord.starty, 2)
	    end for
	elsif workrecord.mode = 3 then
	    for a : workrecord.starty .. workrecord.endy
		placeturt (GridWin, workrecord.startx, a, 3)
	    end for
	elsif workrecord.mode = 4 then
	    for decreasing a : workrecord.starty .. workrecord.endy
		placeturt (GridWin, workrecord.startx, a, 1)
	    end for
	end if
    end for
end fixgridup


proc refreshusergrid (pwn : int)
    p_drawgrid (GridWin)
%    for i : 1 .. 10
%        for a : 1 .. 10
%            if userloc (a, i) = 1 then
%                placeturt (GridWin, a, i, 0)
%            end if
%        end for
%    end for
fixgridup (pwn)
end refreshusergrid
